result = None
while True:

    if result is not None:
        prompt = f"上次结果：{result}\n请输入计算式（如 +5、*3，输入'退出'结束）："
    else:
        prompt = "请输入计算式（如 3+5，输入'退出'结束）："

    user_input = input(prompt)

    if user_input == "退出":
        print("程序结束啦～")
        break

    try:

        if result is not None and user_input[0] in "+-*/":
            full_expression = f"{result}{user_input}"
            result = eval(full_expression)
        else:

            result = eval(user_input)
        print("计算结果：", result)
    except:
        print("输入格式不对哦，请重新输入！")